
    <style>
        input[type="checkbox"] {
            -webkit-appearance: none;
            background:  url(__PUBLIC__/img/shoppingmarket_quanxuan@2x.png);
            height: 18px;
            vertical-align: middle;
            width: 18px;
            background-size: 100% 100%;
        }
        input[type="checkbox"]:checked {
            background:  url(__PUBLIC__/img/shoppingmarket_gou@2x.png);
            height: 18px;
            vertical-align: middle;
            width: 18px;
            background-size: 100% 100%;
        }
    </style>
<div class="page-group">
    <div class="page" data-page="book_kind">
        <header class="bar bar-nav">
            <a onclick="window.location.href='{:U('Cart/index')}'" class="icon" style="width: 40%">
                <img src="__PUBLIC__/img/iconfont_back@2x.png" class="back_img">
            </a>
        </header>
        <div class="content doublecontent" style="bottom:0px;">
            <div style="background: #FFF"  onclick="window.location.href='{:U("User/address")}'">
                <div class="recieve_person word_no_wrap">
                    <div class="recieve_people">收货人：{$add.name}</div>
                    <div class="recieve_num">{$add.phone}</div>
                </div>
                <div class="recieve_address word_no_wrap">
                    收货地址:{$add.province}{$add.city}{$add.district}{$add.address}
                </div>
                <img src="__PUBLIC__/img/xinfen@2x.png" style="width: 100%">
            </div>
            <div style="background: #FFF;margin-top: 10px;padding: 5px">
                <img src="__PUBLIC__/img/bookstore@2x.png">
                <span style="line-height: 30px">新华书店</span>
            </div>


            <div class="list-block media-list" style="margin:0px;">
                <ul id="order_num">
                    <volist name="d" id="v">
                        <li>
                            <a  class="item-link item-content" style="padding-left: 1rem;background: #F5F5F5">
                                <div class="item-media"><img src="{$v.b_logo}" style='width: 4rem;'></div>
                                <div class="item-inner">
                                    <div class="item-title-row">
                                        <div class="item-title">{$v.sm}</div>
                                    </div>
                                    <div class="item-subtitle color_price">原价￥{$v.dj|number_format=###,2}</div>
                                    <div class="item-text" style="height: auto">会员价￥{$v.dj_vip|number_format=###,2}</div>
                                    <div class="item-text" style="height: auto">X{$v.rent_num}</div>
                                </div>
                            </a>
                        </li>
                    </volist>

                </ul>
            </div>
            <div class="trans_fee">
                <span>配送方式</span>
                <span class="user_info_public">快递{$freight_buy|number_format=###,2}元</span>

                    <p style="margin:0px;text-align:right;">
                        共<span id="total_num">{$total}</span>件商品
                        合计（运费）：<font class="color_book_kind_titile">￥{$price_total|number_format=###,2}</font>
                    </p>
            </div>
            <div class="block_remark">
                <span>备注</span>
                <textarea name="remark" id="remark"></textarea>
            </div>
        </div>
        <nav class="bar bar-tab old_bar">
            <a class="tab-item external" href="#">
                <font color="#000">合计（运费）</font><font class="color_book_kind_titile">￥{$price_total|number_format=###,2}</font>
            </a>
            <a class="tab-item external" href="#" onclick="bear_buy('{:I('get.liststr')}')">
                <input class="want_buy" type="button" value="我要购买">
            </a>
        </nav>
    </div>
</div>
<script>
    //产生订单

    function bear_buy($liststr,$is_ffress){
        $(this).attr("disabled",true); //防止重复点击
        $.post("{:U('Order/bear_order_buy')}",{liststr:$liststr,remark:$('#remark').val()},function(data){
            if(data.status=='success'){
                Unifiedorder(data.data);
            }else{
                alert(data.data);
            }
        },'json');
    }
    //统一下单
    function Unifiedorder($pay_id){
        $.post("{:U('Order/getJsApiParameters_buy')}",{id:$pay_id},function(data){
            if(data.status=='complete'){
                alert(data.message);
                window.location.href="{:U('User/order_buy')}";
            }
            if(data.status=="error"){
                alert("无法支付，"+data.message);
            }
            if(data.status=="success"){
                callpay(data.message);
            }
        },'json');
    }

    //微信支付
    function callpay(data)
    {
        if (typeof WeixinJSBridge == "undefined"){
            if( document.addEventListener ){
                document.addEventListener('WeixinJSBridgeReady', jsApiCall, false);
            }else if (document.attachEvent){
                document.attachEvent('WeixinJSBridgeReady', jsApiCall);
                document.attachEvent('onWeixinJSBridgeReady', jsApiCall);
            }
        }else{
            jsApiCall(data);
        }
    }

    function jsApiCall($jsApiParameters)
    {
        WeixinJSBridge.invoke(
                'getBrandWCPayRequest',
                eval('(' + $jsApiParameters + ')'),
                function(res){
                    WeixinJSBridge.log(res.err_msg);
//                    alert(res.err_code+res.err_desc+res.err_msg);
                    window.location.href="{:U('User/order_buy')}";
                }
        );
    }
</script>